 /*window.onload=function(){
	let canv = document.getElementById('canva');
	let cs = canv.getContext('2d');
	let img=new Image();
		  img.src='img/log.png';
		  img.width='178px';
		  img.height='80px';
	img.onload=function(){
		cs.drawImage(img,0,0,150,70)
	}
}*/
$(function(){
	var ii=0;
	$('.login_tel .du ul li').click(function(event){
		event = event || window.event;
		$('#ppp').text(event.target.innerHTML);
		ii = $('.login_tel .du ul')[0].scrollTop-event.target.offsetTop
		// console.log($('.login_tel .du ul')[0].scrollTop)
		$('.login_tel .du ul').css({'top':-event.target.offsetTop+'px','display':'none'})
	})
	$('#ppp').click(function(){
		$('.login_tel .du ul').css({'top': ii-event.target.offsetTop+'px','background':'#fff','overflow':'auto',
			'display':'block'})
		console.log(ii-event.target.offsetTop)
	})
	let a=0;


	$('.login_msg a').click(function(){
		// 校验手机号是否正确
		if(!$('#tel_phone').val()){
			$('#tel_phone').attr('placeholder','请输入正确手机号')
			$('.login_tel .du span').fadeIn('slow', function() {
				$('.login_tel .du span').fadeOut(3000)
			});
		}else if(!/^1[345678]\d{9}$/.test($('#tel_phone').val())){
			$('.login_tel .du span').fadeIn('slow', function() {
				$('.login_tel .du span').fadeOut(3000)
			});
		}else{
			$('#idx').focus()
		}
	})	
	$('.jsmsg a').click(function(){

		a++
		if(a%2==0){
			$('.login_msg a').text('重新获取短信验证码');
			
			$('.jsmsg p').text('接收语音验证码');
		}else{
			$('.login_msg a').text('重新获取语音验证码');
			$('.jsmsg p').text('接收短信验证码');

		}

	})




})

